﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="FL.Web.BackEnd.BasePage" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="/SFramework/boot.js"></script>
    <style type="text/css">
        body {
            padding-left: 0px;
            font-size: 13px;
        }

        h1 {
            font-size: 20px;
            font-family: Verdana;
        }

        h4 {
            font-size: 16px;
            margin-top: 25px;
            margin-bottom: 10px;
        }

        .description {
            padding-bottom: 30px;
            font-family: Verdana;
        }

            .description h3 {
                color: #CC0000;
                font-size: 16px;
                margin: 0 30px 10px 0px;
                padding: 45px 0 8px;
                /*background:url(titleback.png) no-repeat scroll left bottom transparent*/
                border-bottom: solid 1px #888;
            }

        body {
            margin: 0;
            padding: 0;
            border: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        .fileitem {
            float: left;
            margin: 6px;
            padding: 2px;
            width: 200px;
            height: 110px;
        }

            .fileitem img {
                width: 95px;
                height: 80px;
            }

        .filename {
            overflow: hidden;
            text-align: center;
        }

        .selected {
            border: 1px ridge #808080;
            width: 98px;
            height: 108px;
        }
    </style>

    <!--引入皮肤样式-->
    <%--    <link href="../../SFramework/miniui/themes/blue/skin.css" rel="stylesheet" />--%>
</head>

<body  oncontextmenu=self.event.returnValue=false onselectstart="return false">
    <div class="mini-layout" style="width: 100%; height: 100%;">

        <div class="mini-fit">
            <div id="file_list"></div>
        </div>

    </div>
    <script src="/SFramework/ztree/js/jquery.ztree.all-3.3.min.js"></script>
    <script type="text/javascript">
        const_entityID = "<% =EntityId %>",    //实体ID名称
        const_entityName = "<% =EntityName %>",//实体名称
        const_EditEntity = "<% =EditEntity %>",//编辑实体名
        const_functionId = "<% =FunctionID %>",//自定义条件
        const_UserId = "<% = UserId %>",     // 
        const_RootPath = "<%=Server.MapPath("\\").Replace("\\","\\\\").ToLower()%>";
    </script>
    <script type="text/javascript">

        function fnShowFile(data) {
            var _data = data.data;// eval("(" + data + ")");

            $("#file_list").html("");
            $.each(_data, function (i) {
                var _fileName = _data[i].name;
                var _fileExt = _data[i].ext;
                var _path = _data[i].path.replace(/\/g,/) + "/" + _data[i].name;
                var _iconPath = "";
                if (".jpg,.gif,.bmp,.icon,.png".indexOf(_fileExt) > -1) {
                    _iconPath = _path;//"/"+_path.replace(const_RootPath,"").replace(/\/g,/)+"/"+_fileName;
                    var _strHtml = "<div class=\"fileitem\" style=\"width:1020px;height:1350px;\"  fileExt=\"" + _fileExt + "\" file=\"\\" + _iconPath + "\" title=\"" + _fileName + "\" fileName=\"" + _fileName + "\"><div filename=\"\"><img style=\"width:1000px;height:1300px;\" src=\"" + _iconPath + "\"></div></div>";//<div class=\"filename\" title=\"" + _fileName + "\">" + _fileName + "</div>
                    $("#file_list").append(_strHtml);
                } else {
                    console.log(_data);
                    var _strHtml = "<div class=\"fileitem\"  fileExt=\"" + _fileExt + "\" file=\"\\" + _iconPath + "\" title=\"" + _fileName + "\" fileName=\"" + _fileName + "\"><div filename=\"\"><a  href=\"" + _path + "\">" + _data[i].source_file_name + "<a/></div></div>";//<div class=\"filename\" title=\"" + _fileName + "\">" + _fileName + "</div>
                    $("#file_list").append(_strHtml);
                }

            });
            $(".fileitem").click(function () {
                $(".fileitem").removeClass("selected");
                $(this).addClass("selected");
            });
        }


        $(document).ready(function () {
            console.log(getPar("institution_id"));
            var data = fnGetData("t_sys_files", "REPLACE(([path]+'\\'+name),'\\','/') in (select value from dbo.ufn_split_string((select max(files_url) from v_t_system_file where institution_id='" + getPar("institution_id") + "'),',') t ) ", "source_file_name");
            fnShowFile(data);
        });
        //获取URL querystring parameter
        function getPar1(source, name) {
            var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
            if (reg.test(source)) return RegExp.$2; return "";
        }

        function getPar(name) {
            var _url = "http://" + document.location;
            return getPar1(_url, name);
        }

    </script>
    <script src="/Scripts/common/jquery.action.js"></script>
    <script src="/Scripts/common/jquery.data.js"></script>
    <script src="/SFramework/jquery.json-2.2.js"></script>

</body>
</html>
